package com.jy.adscm.operation.mask.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jy.adscm.bean.system.JyCode;
import com.jy.adscm.bean.system.JyUser;
import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.operation.cg.bean.CgMaterial;
import com.jy.adscm.operation.cg.mapper.mysql.CgMaterialMapper;
import com.jy.adscm.operation.mask.bean.*;
import com.jy.adscm.operation.mask.mapper.mysql.*;
import com.jy.adscm.operation.mask.service.KzMachineService;
import com.jy.adscm.operation.mask.service.MaskWorkRecordService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jy.adscm.security.utils.Token;
import com.jy.adscm.system.mapper.mysql.JyCodeMapper;
import com.jy.adscm.system.service.JyUserService;
import com.jy.adscm.utils.AdscmBaseUtils;
import com.jy.adscm.utils.AdscmDateUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.*;

/**
 * <p>
 * 口罩生产工人工作记录表 服务实现类
 * </p>
 *
 * @author yyy
 * @since 2020-03-24
 */
@Service
public class MaskWorkRecordServiceImpl extends ServiceImpl<MaskWorkRecordMapper, MaskWorkRecord> implements MaskWorkRecordService {

    Logger logger = Logger.getLogger(getClass());

    @Autowired
    MaskWorkRecordMapper maskWorkRecordMapper;
    @Autowired
    KzMaterialDetailMapper kzMaterialDetailMapper;
    @Autowired
    KzMaterialMapper kzMaterialMapper;

    @Autowired
    KzMachineService kzMachineService;
    @Autowired
    JyCodeMapper jyCodeMapper;
    @Autowired
    JyUserService jyUserService;
    @Autowired
    CgMaterialMapper cgMaterialMapper;
    @Autowired
    MaskYearWeekMapper maskYearWeekMapper;

    @Override
    public List<GxReportFormSupport> gxReportForm(String beginTime, String endTime)throws AdscmSystemException {

        logger.info("根据时间【"+beginTime+"："+endTime+"】，查询工序统计报表");
        if (beginTime == null || "".equals(beginTime)){
            throw new AdscmSystemException("开始时间为NULL");
        }
        if (endTime == null || "".equals(endTime)){
            throw new AdscmSystemException("结束时间为NULL");
        }

//        beginTime += " 00:00:00";
//        endTime += " 23:59:59";

        List<GxReportFormSupport> forms = maskWorkRecordMapper.gxReportForm(beginTime, endTime);

        Map<String ,List<GxReportFormSupport>> map = new TreeMap<>();
        Map<String ,Map<String,Long>> mapSums = new TreeMap<>();

        if (forms != null && forms.size() > 0) {
            for (GxReportFormSupport form : forms) {
                Long total = form.getOkSum() + form.getReturnSum() + form.getScrapSum();
                Double temp1 = 0d;
                Double temp2 = 0d;
                Double temp3 = 0d;
                if (total != 0){
                    temp1 = form.getOkSum() / total.doubleValue();
                    temp2 = form.getReturnSum() / total.doubleValue();
                    temp3 = form.getScrapSum() / total.doubleValue();
                }
                BigDecimal b = new BigDecimal(temp1);
                double okSumRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                form.setOkSumRate(okSumRate);

                b = new BigDecimal(temp2);
                double returnSumRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                form.setReturnSumRate(returnSumRate);

                b = new BigDecimal(temp3);
                double scrapSumRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                form.setScrapSumRate(scrapSumRate);

                List<GxReportFormSupport> supports = map.get(form.getGxId());
                if (supports == null){
                    supports = new ArrayList<>();
                    map.put(form.getGxId(),supports);
                }
                supports.add(form);

                Map<String, Long> sumsMap = mapSums.get(form.getGxId());
                if (sumsMap == null){
                    sumsMap = new TreeMap<>();
                    mapSums.put(form.getGxId(),sumsMap);
                }
                Long okSum_ = sumsMap.get("okSum");
                Long returnSum_ = sumsMap.get("returnSum");
                Long scrapSum_ = sumsMap.get("scrapSum");
                if(okSum_ == null){
                    okSum_ = 0L;
                }
                if(returnSum_ == null){
                    returnSum_ = 0L;
                }
                if(scrapSum_ == null){
                    scrapSum_ = 0L;
                }

                okSum_ += form.getOkSum();
                returnSum_ += form.getReturnSum();
                scrapSum_ += form.getScrapSum();

                sumsMap.put("okSum",okSum_);
                sumsMap.put("returnSum",returnSum_);
                sumsMap.put("scrapSum",scrapSum_);


            }
        }

        List<GxReportFormSupport> allSupports = new ArrayList<>();

        Set<String> allGx = map.keySet();
        if (allGx != null && allGx.size() > 0){
            Iterator<String> iterator = allGx.iterator();
            while (iterator.hasNext()){
                String gx = iterator.next();
                Map<String, Long> sumsMap = mapSums.get(gx);

                GxReportFormSupport support = new GxReportFormSupport();

                Long okSum_ = sumsMap.get("okSum");
                Long returnSum_ = sumsMap.get("returnSum");
                Long scrapSum_ = sumsMap.get("scrapSum");

                support.setOkSum(okSum_);
                support.setReturnSum(returnSum_);
                support.setScrapSum(scrapSum_);

                Double temp1 = 0d;
                Double temp2 = 0d;
                Double temp3 = 0d;
                Long total = okSum_ + returnSum_ + scrapSum_;
                if(total != 0){
                    temp1 = okSum_ / total.doubleValue();
                    temp2 = returnSum_ / total.doubleValue();
                    temp3 = scrapSum_ / total.doubleValue();
                }

                BigDecimal b = new BigDecimal(temp1);
                double okSumRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                support.setOkSumRate(okSumRate);

                b = new BigDecimal(temp2);
                double returnSumRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                support.setReturnSumRate(returnSumRate);

                b = new BigDecimal(temp3);
                double scrapSumRate = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                support.setScrapSumRate(scrapSumRate);

                support.setWorkMacName("合计");
                support.setWorkMacId("-1");
                support.setGxId(gx);
                List<GxReportFormSupport> gxSupports = map.get(gx);
                if (gxSupports != null && gxSupports.size()>0){
                    support.setGxName(gxSupports.get(0).getGxName());
                }
                gxSupports.add(0,support);

                allSupports.addAll(gxSupports);

            }
        }
        return allSupports;
    }


    @Override
    public GxReportGanttSupport gxReportGantt(Long macId, String beginTime, String endTime) throws AdscmSystemException {

        logger.info("根据机床ID【"+macId+"】和时间【"+beginTime+"："+endTime+"】，查询工序统计甘特图");

        if (!AdscmBaseUtils.getInstance().isNotEmpty(macId,null)){
            throw new AdscmSystemException("参数[macId]缺失...");
        }
        if (!AdscmBaseUtils.getInstance().isNotEmpty(beginTime,null)){
            throw new AdscmSystemException("参数[beginTime]缺失...");
        }
        if (!AdscmBaseUtils.getInstance().isNotEmpty(endTime,null)){
            throw new AdscmSystemException("参数[endTime]缺失...");
        }

//        beginTime += " 00:00:00";
//        endTime += " 23:59:59";


        GxReportGanttSupport support = new GxReportGanttSupport();


        KzMachine machine =  kzMachineService.selectById(macId);
        if (machine != null) {
            support.setWorkMacId(macId.toString());
            support.setWorkMacName(machine.getName());

            //口罩生产工序
            List<JyCode> gxList = jyCodeMapper.getJyCodeByCodeType("MASK_GX");
            for (JyCode jyCode : gxList) {
                if(jyCode.getCode().equals(machine.getBelongGx())){
                    support.setGxId(jyCode.getCode());
                    support.setGxName(jyCode.getName());
                    break;
                }
            }
            support.setBeginTime(beginTime);
            support.setEndTime(endTime);


            //record_type = 1 二维码输入，2: 照片输入

            Wrapper<MaskWorkRecord> recordWrapper = new EntityWrapper<>();
            recordWrapper.eq("work_mac",macId);
            recordWrapper.in("record_type",new String[]{"1","2"});
            recordWrapper.between("record_time",beginTime,endTime);
            recordWrapper.orderBy("record_time",true);
            List<MaskWorkRecord> records = maskWorkRecordMapper.selectList(recordWrapper);

            //输入
            Map<String ,List<GxReportGantt>> inputMap = new TreeMap<>();
            support.setInputMap(inputMap);
            if (records != null && records.size()>0){
                for(int i=0;i<records.size();i++){
                    MaskWorkRecord record = records.get(i);

                    GxReportGantt gantt = new GxReportGantt();
                    if (record.getProductWeight() != null && record.getProductWeight()>0){
                        gantt.setMaterialWeight(record.getProductWeight().toString());
                    }else {
                        gantt.setMaterialWeight("-");
                    }
                    if (record.getProductTotal() != null && record.getProductTotal()>0){
                        gantt.setMaterialCount(record.getProductTotal().toString());
                    }else {
                        gantt.setMaterialCount("-");
                    }
                    gantt.setStorageTime("-");
                    gantt.setStartUseTime(AdscmDateUtils.getDateFomat(record.getRecordTime()));

                    Integer empId = record.getEmpId();
                    if (empId != null && empId>0){
                        JyUser jyUser = jyUserService.selectById(empId);
                        gantt.setUseUserName(jyUser.getName());

                    }

                    String recordType = record.getRecordType();
                    if ("1".equals(recordType)){
                        //二维码录入
                        String matterCode = record.getMatterCode();
                        if(matterCode != null){
                            if(matterCode.indexOf("合格") > -1){
                                //用的上一个环节的合格品
                                gantt.setMaterialName("合格半成品");
                            }else{
                                //物料编号录入
                                String materialName = record.getMaterialName();
                                if (AdscmBaseUtils.getInstance().isNotEmpty(materialName,null)){
                                    gantt.setMaterialName(materialName);
                                    if (record.getMaterialId() != null){
                                        Wrapper<KzMaterialDetail> mdWrapper = new EntityWrapper<>();
                                        mdWrapper.eq("code",matterCode);
                                        List<KzMaterialDetail> details = kzMaterialDetailMapper.selectList(mdWrapper);
                                        if (details != null && details.size()>0) {
                                            KzMaterialDetail detail = details.get(0);
                                            KzMaterial material = kzMaterialMapper.selectById(detail.getPid());
                                            gantt.setStorageTime(AdscmDateUtils.getNowOnlyDateFomat1(material.getInStockDate()));
                                        }
                                    }
                                }else {
                                    Wrapper<KzMaterialDetail> mdWrapper = new EntityWrapper<>();
                                    mdWrapper.eq("code",matterCode);
                                    List<KzMaterialDetail> details = kzMaterialDetailMapper.selectList(mdWrapper);
                                    if (details != null && details.size()>0){
                                        KzMaterialDetail detail = details.get(0);
                                        KzMaterial material = kzMaterialMapper.selectById(detail.getPid());
                                        CgMaterial cgMaterial = cgMaterialMapper.selectById(material.getMaterial());

                                        gantt.setMaterialWeight(detail.getWeight()+"");
                                        materialName = cgMaterial.getName() + cgMaterial.getType();

                                        gantt.setMaterialName(materialName);
                                        gantt.setStorageTime(AdscmDateUtils.getNowOnlyDateFomat1(material.getInStockDate()));

                                    }else{
                                        gantt.setMaterialName("其他物料");
                                    }
                                }

                            }
                        }
                    }else{
                        //照片录入
                        String materialName = record.getMaterialName();
                        if (AdscmBaseUtils.getInstance().isNotEmpty(materialName,null)){
                            gantt.setMaterialName(materialName);
                        }else {
                            gantt.setMaterialName("其他物料");
                        }
                    }

//                    if(i < (records.size()-1)){
//                        MaskWorkRecord nextRecord = records.get(i+1);
//                        gantt.setEndUseTime(AdscmDateUtils.getDateFomat(nextRecord.getRecordTime()));
//                        gantt.setIsEnd("1");
//                    }else{
//                        //手动查询下一个
//                        gantt.setIsEnd("0");
//                    }


                    List<GxReportGantt> list = inputMap.get(gantt.getMaterialName());
                    if (list == null){
                        list = new ArrayList<>();
                        inputMap.put(gantt.getMaterialName(),list);
                    }

                    list.add(gantt);


                }

            }


            //输出
            Map<String ,List<GxReportGantt>> outputMap = new TreeMap<>();
            support.setOutputMap(outputMap);

            recordWrapper = new EntityWrapper<>();
            recordWrapper.in("record_type",new String[]{"5","6","7"});
            recordWrapper.eq("work_mac",macId);
            recordWrapper.between("record_time",beginTime,endTime);
            recordWrapper.orderBy("record_time",true);
            List<MaskWorkRecord> recordsOut = maskWorkRecordMapper.selectList(recordWrapper);
            if (recordsOut != null && recordsOut.size()>0) {
                for (int i = 0; i < recordsOut.size(); i++) {
                    MaskWorkRecord record = recordsOut.get(i);

                    GxReportGantt gantt = new GxReportGantt();

                    Integer empId = record.getEmpId();
                    if (empId != null && empId>0){
                        JyUser jyUser = jyUserService.selectById(empId);
                        gantt.setUseUserName(jyUser.getName());

                    }
                    String recordType = record.getRecordType();
                    if ("5".equals(recordType)){
                        //合格品
                        gantt.setMaterialName("合格品");
                    }else if ("6".equals(recordType)){
                        //返工品
                        gantt.setMaterialName("返工品");
                    }else {
                        //报废
                        gantt.setMaterialName("报废品");
                    }

                    if (record.getProductWeight() != null && record.getProductWeight()>0){
                        gantt.setMaterialWeight(record.getProductWeight().toString());
                    }else {
                        gantt.setMaterialWeight("-");
                    }
                    if (record.getProductTotal() != null && record.getProductTotal()>0){
                        gantt.setMaterialCount(record.getProductTotal().toString());
                    }else {
                        gantt.setMaterialCount("-");
                    }
                    gantt.setStorageTime("-");
                    gantt.setStartUseTime(AdscmDateUtils.getDateFomat(record.getRecordTime()));

//                    if(i < (recordsOut.size()-1)){
//                        MaskWorkRecord nextRecord = recordsOut.get(i+1);
//                        gantt.setEndUseTime(AdscmDateUtils.getDateFomat(nextRecord.getRecordTime()));
//                        gantt.setIsEnd("1");
//                    }else{
//                        //手动查询下一个
//                        gantt.setIsEnd("0");
//                    }



                    List<GxReportGantt> list = outputMap.get(gantt.getMaterialName());
                    if (list == null){
                        list = new ArrayList<>();
                        outputMap.put(gantt.getMaterialName(),list);
                    }

                    list.add(gantt);
                }
            }

            if (support.getInputMap() != null){
                support.setInputMapKey(support.getInputMap().keySet());

                Map<String, List<GxReportGantt>> temp = support.getInputMap();
                Set<String> inputMapKey = support.getInputMapKey();

                this.loadEndTime(inputMapKey,temp,endTime);

            }
            if (support.getOutputMap() != null){
                support.setOutputMapKey(support.getOutputMap().keySet());

                Map<String, List<GxReportGantt>> temp = support.getOutputMap();
                Set<String> outputMapKey = support.getOutputMapKey();

                this.loadEndTime(outputMapKey,temp,endTime);
            }




        }else {
            throw new AdscmSystemException("没有查询到机器ID【"+macId+"】的机器");
        }




        return support;
    }

    private void loadEndTime( Set<String> inputMapKey,Map<String, List<GxReportGantt>> temp,String endTimeStr){
        Iterator<String> iterator = inputMapKey.iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            List<GxReportGantt> reportGantts = temp.get(next);
            if (reportGantts != null && reportGantts.size()>0){
                for(int i=0;i<reportGantts.size();i++){
                    GxReportGantt thisGantt = reportGantts.get(i);
                    if(i < (reportGantts.size()-1)){
                        GxReportGantt nextGantt = reportGantts.get(i+1);
                        Date date = AdscmDateUtils.getDateFomat(nextGantt.getStartUseTime());
                        String dateStr = AdscmDateUtils.getDateFomat(AdscmDateUtils.getThatDate(date, -20, Calendar.SECOND));
                        thisGantt.setEndUseTime(dateStr);
                        thisGantt.setIsEnd("1");
                    }else{
                        //手动查询下一个
                        thisGantt.setEndUseTime(endTimeStr);
                        thisGantt.setIsEnd("0");
                    }

                    Date endTime = AdscmDateUtils.getDateFomat(thisGantt.getEndUseTime());
                    Date startTime = AdscmDateUtils.getDateFomat(thisGantt.getStartUseTime());

                    Long len = (endTime.getTime() - startTime.getTime()) / 1000L ;
                    String lenStr = AdscmDateUtils.getInputSecondsOuptHourMin(len);
                    thisGantt.setUseTimeLen(lenStr);

                }
            }

        }
    }

    @Override
    public Boolean updateMaskWorkRecord(MaskWorkRecord maskWorkRecord, Token token) {

        maskWorkRecord.setCreator(token.getUser().getId().toString());
        maskWorkRecord.setCreateTime(new Date());
        boolean b = super.updateById(maskWorkRecord);
        return b;
    }

    @Override
    public Boolean deleteMaskWorkRecord(Long id, Token token) {
        MaskWorkRecord maskWorkRecord = super.selectById(id);
        maskWorkRecord.setState(0);
        boolean b = super.updateById(maskWorkRecord);
        return b;
    }



    @Override
    public List<GxReportBarChartsSupport> gxReportBarCharts(Integer year, Integer type) {
        if (year == null){
            year = AdscmDateUtils.getTheYear(new Date());
        }
        if (type == null){
            type = 2;
        }
        logger.info("工序统计柱形图，按照某一年的季度/月统计，年：【"+year+"】类型：【"+type+"】");

        //1：按照季度统计、2：按照月统计
        List<GxReportBarChartsSupport> list = null;
        if (type != null && type == 2){
            list = maskWorkRecordMapper.gxReportBarChartsGroupByMonth(year);
        }else {
            list = maskWorkRecordMapper.gxReportBarChartsGroupByQuarter(year);
        }
        return list;
    }

    @Override
    public Map<String ,Object> gxReportBarChartsByWeek(Integer year, Integer type, Integer target) {

        if (year == null){
            year = AdscmDateUtils.getTheYear(new Date());
        }
        if (type == null){
            type = 1;//默认没有的话就某个月
        }
        if (target == null){
            target = 1;//默认没有的话就第一个月或第一个季度
        }
        logger.info("工序统计柱形图，按照周统计，年：【"+year+"】类型：【"+type+"】月/季度：【"+target+"】");
        Map<String ,Object> map = new TreeMap<>();
//        gxReportBarChartsGroupByWeek
        String beginTime = null;
        String endTime = null;
        Date beginTimeD = null;
        Date endTimeD = null;
                List<Integer> weeks = new ArrayList<>();
        if (type != null && type == 2){
            //月
            beginTime = year +"-"+ target +"-01 08:30:00";
            beginTimeD = AdscmDateUtils.getDateFomat(beginTime);
            endTimeD = AdscmDateUtils.getLastDayOfTheMonth(beginTimeD);

        }else {
            //季度
            switch (target){
                case 1:{
                    beginTime = year +"-01-01 08:30:00";
                    endTime = year +"-03-31 23:59:59";
                    break;
                }
                case 2:{
                    beginTime = year +"-04-01 08:30:00";
                    endTime = year +"-06-30 23:59:59";
                    break;
                }
                case 3:{
                    beginTime = year +"-07-01 08:30:00";
                    endTime = year +"-09-30 23:59:59";
                    break;
                }
                case 4:{
                    beginTime = year +"-10-01 08:30:00";
                    endTime = year +"-12-31 23:59:59";
                    break;
                }
                default:{
                    beginTime = year +"-04-01 08:30:00";
                    endTime = year +"-06-30 23:59:59";
                    break;
                }
            }
            beginTimeD = AdscmDateUtils.getDateFomat(beginTime);
            endTimeD = AdscmDateUtils.getDateFomat(endTime);
        }

        List<MaskYearWeek> weekList = maskYearWeekMapper.getListBetweenTime(beginTimeD, endTimeD);
        List<Integer> weeksList = new ArrayList<>();
        if (weekList != null && weekList.size()>0){
            for (MaskYearWeek week : weekList) {
                if (week.getBeginTime().getTime() <= beginTimeD.getTime()){
                    beginTimeD = week.getBeginTime();
                }
                if (week.getEndTime().getTime()>= endTimeD.getTime()){
                    endTimeD = week.getEndTime();
                }
                weeks.add(week.getWeek());
                weeksList.add(week.getWeek());
            }
        }

        beginTime = AdscmDateUtils.getDateFomat(beginTimeD);
        endTime = AdscmDateUtils.getDateFomat(endTimeD);

        List<GxReportBarChartsWeekSupport> list = maskWorkRecordMapper.gxReportBarChartsGroupByWeek(year,weeks,beginTime,endTime);
        map.put("weeks",weeksList);
        map.put("data",list);
        return  map;
    }

    @Override
    public List<GxReportBarChartsClassesSupport> gxReportBarChartsByClasses(Integer year, Integer week) throws AdscmSystemException{
        logger.info("工序统计柱形图，按照班次统计某一周的统计图，年：【"+year+"】，周：【"+week+"】");
        if (year == null){
            year = AdscmDateUtils.getTheYear(new Date());
        }
        if (week == null){
            week = 1;//默认没有的话就第一周
        }
        List<GxReportBarChartsClassesSupport> data = new ArrayList<>();

        //查询这一年这一周的开始结束时间
        Wrapper<MaskYearWeek> weekWrapper = new EntityWrapper<>();
        weekWrapper.eq("year",year);
        weekWrapper.eq("week",week);
        List<MaskYearWeek> weeks = maskYearWeekMapper.selectList(weekWrapper);
        MaskYearWeek yearWeek = null;
        if (weeks != null && weeks.size()>0){
            yearWeek = weeks.get(0);
        }
        if(yearWeek == null){
            throw new AdscmSystemException("查询异常，没有找到对应周");
        }
        Date beginTime = yearWeek.getBeginTime();

        String weekBeginTimeStr = AdscmDateUtils.getDateFomat(beginTime);//yyyy-MM-dd HH:mm:ss
        String weekEndTimeStr = AdscmDateUtils.getDateFomat(yearWeek.getEndTime());//yyyy-MM-dd HH:mm:ss
//        String beginDateStr = AdscmDateUtils.getDateFomats(beginTime);//yyyy-MM-dd

        for (int i=0;i<7;i++){
            String beginDateStr = AdscmDateUtils.getThatDateStr(beginTime, i, Calendar.DATE);
            //早班
            String beginTimeStr = beginDateStr + " 08:30:00";
            String endTimeStr = beginDateStr + " 20:29:59";

            List<GxReportBarChartsClassesSupport> btw = maskWorkRecordMapper.getReportBarChartsBtw(beginTimeStr, endTimeStr);
            if (btw != null && btw.size()>0){
                for (GxReportBarChartsClassesSupport gxReport : btw) {
                    gxReport.setYear(year+"");
                    gxReport.setWeek(week);
                    gxReport.setWeekBeginTime(weekBeginTimeStr);
                    gxReport.setWeekEndTime(weekEndTimeStr);
                    gxReport.setCurrentDate(beginDateStr);
                    gxReport.setCurrentWeek(i+1);
                    gxReport.setDateClasses("1");
                    gxReport.setDateClassesDesc("白班");
                }
                data.addAll(btw);
            }

            String beginDateStr_ = AdscmDateUtils.getThatDateStr(beginTime, i+1, Calendar.DATE);
            //晚班
            beginTimeStr = beginDateStr + " 20:30:00";
            endTimeStr = beginDateStr_ + " 08:29:59";

            List<GxReportBarChartsClassesSupport> btw1 = maskWorkRecordMapper.getReportBarChartsBtw(beginTimeStr,endTimeStr);
            if (btw1 != null && btw1.size()>0){
                for (GxReportBarChartsClassesSupport gxReport : btw1) {
                    gxReport.setYear(year+"");
                    gxReport.setWeek(week);
                    gxReport.setWeekBeginTime(weekBeginTimeStr);
                    gxReport.setWeekEndTime(weekEndTimeStr);
                    gxReport.setCurrentWeek(i+1);
                    gxReport.setCurrentDate(beginDateStr);
                    gxReport.setDateClasses("2");
                    gxReport.setDateClassesDesc("晚班");
                }
                data.addAll(btw1);
            }

        }

//        getReportBarChartsBtw
        return data;
    }
}
